package acwing._1_1AlgorithmBasic._4Math;
/**
 * @Project : AlgorithmLearning
 * @Package : ACWing._1_1AlgorithmBasic._4Math
 * @File : Q0874.java
 * @Author : WangRuoyu
 * @Date : 2023/4/4 17:10
 */

import java.io.*;

public class Q0874 {

    static long phiSum(int n) {
        int cnt = 0;
        int[] primes = new int[n + 1];
        int[] p = new int[n + 1];
        boolean[] st = new boolean[n + 1];

        p[1] = 1;
        for (int i = 2; i <= n; ++i) {
            if (!st[i]) {
                primes[cnt++] = i;
                p[i] = i - 1;
            }
            for (int j = 0; primes[j] <= n / i; ++j) {
                st[primes[j] * i] = true;
                if (i % primes[j] == 0) {
                    p[primes[j] * i] = primes[j] * p[i];
                    break;
                }
                p[primes[j] * i] = (primes[j] - 1) * p[i];
            }
        }

        long res = 0;
        for (int i = 1; i < p.length; ++i) {
            res += p[i];
        }
        return res;
    }

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter wr = new BufferedWriter(new OutputStreamWriter(System.out));
        String[] words = br.readLine().split(" ");
        int n = Integer.parseInt(words[0]);
        wr.write(phiSum(n) + "");
        wr.flush();
    }
}

